#include <STC15F2K60S2.H>


void led_disp(uchar adder,enable)
{

	static uchar temp = 0x00;
	static uchar temp_old = 0xff;	
	
	if(enable)
	temp |= 0x01 << adder;
	else
	temp &= ~(0x01<<adder);
	
	if(temp != temp_old)
	{
	
	P0 =~temp ;
	P2 = P2 &0X1F |0X80;
	P2 &=0X1F ;
	
	temp_old = temp;
	
	}

}


void relay(uchar dat)
{

	static uchar temp1 = 0x00;
	static uchar temp_old1 = 0xff;	
	
	if(dat)
	temp1 |= 0x10 ;
	else
	temp1 &= ~0x10;
	
	if(temp1 != temp_old1)
	{
	
	P0 =temp1 ;
	P2 = P2 &0X1F |0Xa0;
	P2 &=0X1F ;
	
	temp_old1 = temp1;
	
	}

}
void Pulse(unsigned char flag)
{
	static uchar temp1 = 0x00;
	static uchar temp_old1 = 0xff;	
	if(flag)
		temp1 |= 0x20;
	else
		temp1 &= ~0x20;
	if(temp1 != temp_old1)
	{
		P0 = temp1;
		P2 = P2 & 0x1f | 0xa0;
		P2 &= 0x1f;
		temp_old1 = temp1;		
	}	
}